package com.example.mobile2021606128wje0615;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private RecyclerView rvMainContent;
    private List<StudentScore> list=new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        initView();
//        list.add( new StudentScore( 1,"张三",20,88) );
//        list.add( new StudentScore( 2,"李四",19,99 ) );99
        list=new MyDataAdapter().QueryAll( this );
        //创建RV适配对象，并设置给列表控件
        rvMainContent.setAdapter( new StudentRVAdapter( list ) );
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById( R.id.tvMainTitle );
        rvMainContent = (RecyclerView) findViewById( R.id.rvMainContent );
        rvMainContent.setLayoutManager( new LinearLayoutManager( this ) );
    }
}